package com.yifeng.repo.base.service.impl;

import com.yifeng.base.mqtt.api.MqttMsgRestService;
import com.yifeng.base.mqtt.api.params.CompanyMsgSendParam;
import com.yifeng.base.mqtt.api.params.StoreMsgSendParam;
import com.yifeng.repo.base.params.ConsoleParam;
import com.yifeng.repo.base.security.proxy.CommonProxy;
import com.yifeng.repo.base.utils.converter.JacksonHelper;

/**
 * Created by daibing on 2024/5/14.
 * @deprecated 建议使用 {@link MqttRestServiceImpl}
 */
@Deprecated
public class MqttMsgRestServiceImpl extends CommonProxy implements MqttMsgRestService {
    private final String mapping;

    public MqttMsgRestServiceImpl(ConsoleParam consoleParam) {
        super(consoleParam);
        this.mapping = "/yf-auth-platform/rest/mqtt/MqttMsgRestService";
    }

    @Override
    public Long sendCompanyMsg(CompanyMsgSendParam param) {
        String url = consoleParam.getUrl() + mapping + "/sendCompanyMsg";
        String body = JacksonHelper.toJson(param);
        return this.doActionCallByRpc(url, body, Long.class);
    }

    @Override
    public Long sendVipCompanyMsg(CompanyMsgSendParam param) {
        String url = consoleParam.getUrl() + mapping + "/sendVipCompanyMsg";
        String body = JacksonHelper.toJson(param);
        return this.doActionCallByRpc(url, body, Long.class);
    }

    @Override
    public Long sendStoreMsg(StoreMsgSendParam param) {
        String url = consoleParam.getUrl() + mapping + "/sendStoreMsg";
        String body = JacksonHelper.toJson(param);
        return this.doActionCallByRpc(url, body, Long.class);
    }

    @Override
    public Long sendVipStoreMsg(StoreMsgSendParam param) {
        String url = consoleParam.getUrl() + mapping + "/sendVipStoreMsg";
        String body = JacksonHelper.toJson(param);
        return this.doActionCallByRpc(url, body, Long.class);
    }
}
